const url = 'http://localhost:5000/student'

import axios from "axios"

export const fetchAllData = async (keyword) => {
    let data
if(keyword){
    data = await axios.get(`${url}?keyword=${keyword}`)
}
else{
    data = await axios.get(`${url}`)

}
    
    return data.data
}
export const delData = async (id) => {
   await axios.delete(`${url}/${id}`)
}

export const addData=async (obj)=>{
    await axios.post(`${url}`,obj)
}

export const fetchSigleData =async (id)=>{
   const data= await axios.get(`${url}/${id}`)
   return data.data
}
export const editData =async (id,obj)=>{
    await axios.put(`${url}/${id}`,obj)
}